package com.tzy.rabbitmq.publish_subscribe;

import com.rabbitmq.client.Channel;
import com.rabbitmq.client.Connection;
import com.tzy.rabbitmq.constant.RabbitmqConstant;
import com.tzy.rabbitmq.utils.RabbitmqUtil;

import java.io.IOException;
import java.nio.charset.StandardCharsets;
import java.util.Scanner;
import java.util.concurrent.TimeoutException;

/**
 * 气象局
 * @author 自律且自强ing
 */
public class WeatherBureau {
    public static void main(String[] args) throws IOException, TimeoutException {
        Connection connection = RabbitmqUtil.getConnection();
        String input = new Scanner(System.in).next();
        final Channel channel = connection.createChannel();

        //第一个参数:交换机名字; 其他参数和之前一样
        channel.basicPublish(RabbitmqConstant.EXCHANGE_WEATHER, "" ,null,input.getBytes(StandardCharsets.UTF_8));
        channel.close();
        connection.close();


    }







}
